<%--
    Created on : 2019
    Author     : 黄忠
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="dateManager.LookDateBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>个人信息管理系统->修改日程</title>
    <link rel="stylesheet" href="../CSS/infor.css">
</head>
<body bgcolor="CCCFFF">
<%
    String date=request.getParameter("date");
    ArrayList datelist=(ArrayList)session.getAttribute("datelist");
%>
<br>
<div id="showUpdate">
    <div style="float: left;width: 100%">
        <button style="float: right;" onclick="closeUpdate()">关闭</button>
    </div>
    <form action="http://localhost:8080/UpdateDateServlet?date=<%=date%>" method="post">
        <table border="2" cellspacing="0" cellpadding="0" style="width: 90%;" align="center">
            <%
                if(date!=null){
                    LookDateBean nf = null;
                    for(int i=datelist.size()-1;i>=0;i--) {
                        nf = (LookDateBean) datelist.get(i);
                        if(nf.getDate().equals(date)) break;
                    }
            %>
            <tr>
                <td>日程时间</td>
                <td><input required="required" value="<%=nf.getDate()%>" type="date" name="newdate"/></td>
            </tr>
            <tr>
                <td>日程内容</td>
                <td><input required="required" value="<%=nf.getThing()%>" type="text" name="thing"/></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" value="确 定" size="12">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="reset" value="清 除" size="12">
                </td>
            </tr>
            <%
                }
            %>
        </table>
    </form>
    <br>
</div>
<br>
<form action="http://localhost:8080/UpdateDateServlet?date=<%=date%>" method="post">
        <%
            if(datelist==null||datelist.size()==0){
        %>
        <div align="center">
            <h1>您还没有任何日程！</h1>
        </div>
        <%
        } else{
        %>
            <table border="2" cellspacing="0" cellpadding="0" style="width: 99%;" align="center">
                <tr>
                    <th>日程时间</th>
                    <th>日程内容</th>
                    <th>操作</th>
                </tr>
            </table>
            <table id="pageMain"  cellspacing="0" cellpadding="0" style="width: 99%;" align="center">
        <%
            for(int i=datelist.size()-1;i>=0;i--){
                LookDateBean ff=(LookDateBean)datelist.get(i);
        %>
        <tr class="hoverTr">
            <td><%=ff.getDate()%></td>
            <td><%=ff.getThing()%></td>
            <td><a href="http://localhost:8080/dateManager/updateDate.jsp?date=<%=ff.getDate()%>">修改</a></td>
        </tr>
        <%
                }
            }
        %>
    </table>
</form>
</body>
<%@include file="../page.jsp" %>
</html>
<script src="../JS/update.js"></script>
<script>
    window.onload=function () {
        if(getArgs("date")!=null){
            showUpdate();
        }
    }
</script>

